$(document).ready(function () {
    var selectedElement = null;
    var overlayTimeout = null;

    $('.tappable').on('touchstart', function () {
        selectedElement = $(this);
        overlayTimeout = setTimeout(function () {
            if (selectedElement.is(":visible"))
                selectedElement.addClass('active');
        }, 100);
    });
    $(document).bind('touchend touchmove', function () {
        if (selectedElement) {
            selectedElement.removeClass('active');
            clearTimeout(overlayTimeout);
        }
    });
});